//
//  AppDelegate.swift
//  YYJWeibo
//
//  Created by yujing on 16/5/11.
//  Copyright © 2016年 yujing. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        // 设置外观应该尽量早
        setupAppearance()
        
        // 创建window
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        // 设置window的背景色
        window?.backgroundColor = UIColor.whiteColor()
        // 设置window的跟控制器
        window?.rootViewController = MainViewController()
        // 设置window为主窗口并显示
        window?.makeKeyAndVisible()
        
        return true
    }


}

// MARK: - 设置应用程序
extension AppDelegate {

    // 设置全局外观，一经设置，全局有效
    
    private func setupAppearance() {
    
        UINavigationBar.appearance().tintColor = YJAppearanceTintColor
        UITabBar.appearance().tintColor = YJAppearanceTintColor
        
        // 设置导航栏标题字体
        UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont.systemFontOfSize(16)]

    }

}

